package com.darren.archive.entity;

import com.darren.framework.entity.BaseEntity;
import com.darren.framework.utils.Constant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.annotations.ResultCheckStyle;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.Table;
import java.io.Serializable;

/**
 * 系统字典表
 */
@ApiModel(value = "系统字信息")
@Entity
@Table(name = Constant.TABLE_NAME_PREV + "dictionary")
@SQLDelete(sql = "update " + Constant.TABLE_NAME_PREV + "dictionary set is_delete = true,version=version+1 where id=? and version=?", check = ResultCheckStyle.COUNT)
@Where(clause = " is_delete  = false ")
public class SysDictionary extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 664133737598187464L;
    /**
     * 类别编码，最大长度30个字符
     */
    @ApiModelProperty(notes = "类别编码，最大长度30个字符")
    @Column(name = "category_code", columnDefinition = "varchar(50) NOT NULL comment '类别编码，最大长度30个字符'")
    private String categoryCode;


    /**
     * 类别名称，最大长度20个字符
     */
    @ApiModelProperty(notes = "类别名称，最大长度20个字符")
    @Column(name = "category_name", columnDefinition = "varchar(20) NOT NULL comment '类别名称，最大长度20个字符'")
    private String categoryName;


    /**
     * 字典项值，最大长度50个字符
     */
    @ApiModelProperty(notes = "字典项值，最大长度50个字符")
    @Column(name = "item_value", columnDefinition = "varchar(20) NOT NULL comment '字典项值，最大长度50个字符'")
    private String itemValue;


    /**
     * 字典项名称，最大长度20个字符
     */
    @ApiModelProperty(notes = "字典项名称，最大长度20个字符")
    @Column(name = "item_name", columnDefinition = "varchar(20) NOT NULL comment '字典项名称，最大长度20个字符'")
    private String itemName;

    /**
     * 字典项序号，最大长度10个字符
     */
    @ApiModelProperty(notes = "字典项序号，最大长度10个字符")
    @Column(name = "item_sequence", columnDefinition = "varchar(20) NOT NULL comment '字典项序号，最大长度10个字符'")
    private String itemSequence = "1";

    /**
     * 是否启用 false：禁用  true：启用
     */
    @ApiModelProperty(notes = "是否启用 false：禁用  true：启用")
    @Column(name = "is_enable", columnDefinition = "bit default 0 comment '是否启用：0：禁用  1：启用'")
    private Boolean enable = true;

    /**
     * 是否允许编辑 true：可编辑，false：不可编辑。内置的字典不允许编辑
     */
    @ApiModelProperty(notes = "是否允许编辑 true：可编辑，false：不可编辑。内置的字典不允许编辑")
    @Column(name = "is_editable", columnDefinition = "tinyint default 0 comment '是否允许编辑 1：可编辑，0：不可编辑。内置的字典不允许编辑'")
    private boolean editable = true;


    public String getCategoryCode() {
        return categoryCode;
    }

    public void setCategoryCode(String categoryCode) {
        this.categoryCode = categoryCode;
    }

    public String getCategoryName() {
        return categoryName;
    }

    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }

    public String getItemValue() {
        return itemValue;
    }

    public void setItemValue(String itemValue) {
        this.itemValue = itemValue;
    }

    public String getItemName() {
        return itemName;
    }

    public void setItemName(String itemName) {
        this.itemName = itemName;
    }

    public String getItemSequence() {
        return itemSequence;
    }

    public void setItemSequence(String itemSequence) {
        this.itemSequence = itemSequence;
    }

    public Boolean getEnable() {
        return enable;
    }

    public void setEnable(Boolean enable) {
        this.enable = enable;
    }

    public boolean isEditable() {
        return editable;
    }

    public void setEditable(boolean editable) {
        this.editable = editable;
    }
}